const axios = require("axios");

axios.interceptors.response.use((res)=>{
    return res.data;
},(err)=>{
    // Promise.reject('请求失败')
    throw '请求失败'
});
async function fetchRepoList(userName) {
    return await axios.get('https://api.github.com/users/'+userName+'/repos');
}
async function fetchTag(userName,repo) {
    return await axios.get('https://api.github.com/repos/'+userName+'/'+repo+'/tags');
}
module.exports = {
    fetchRepoList,
    fetchTag
}